package dbms.query;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import dbms.Debug;

public class ProjectPlan extends Plan{
	
	public List<String> selectList;
	
	public ProjectPlan(List<String> selectList){
		this.selectList = selectList;
	}

	public ResultSet execute(ResultSet oldResultSet) {

		Map<String, List<Object>> oldResult = oldResultSet.resultSet;
		Map<String, List<Object>> resultSet = new HashMap<String, List<Object>>();
		
		for (String attr : selectList) {
			resultSet.put(attr, oldResult.get(attr));
		}
		
		return new ResultSet(resultSet);
	}

}
